package com.shhic.itsed.mws.deviceintf;

import lombok.ToString;

import java.io.Serializable;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * 阅读器指令
 * 
 * 统一抽象的阅读器指令，屏蔽各类具体的物理阅读器类型。具体物理阅读器根据自身要求，选用本模型中的域；
 * 每个物理阅读器只生成一个本对象，并通过IReaderCommandNotifier接口通知到设备调度模块。
 * 
 * @author 张文硕
 *
 */
@ToString
public class ReaderCommand implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	private ReaderCommandType readerCommandType = ReaderCommandType.CYCLE;	//阅读器指令类型，默认为周期指令，即下达后始终存在，循环执行，不停上报 

	private String readerClass;	//设备类型
	private String readerId;	//阅读器标识
	private String readerIp;	//设备地址
	private int readerPort;		//设备端口号
	
	private Set<AntennaProtocol> antennaProtocolSet;	//天线-协议组
	
	private List<RawTagField> readTagFieldList;	//待读取的标签区列表
	
	//后续在这里扩展写、锁等标签操作的指令，本期暂不考虑标签操作。
	
	
	

	public ReaderCommandType getReaderCommandType() {
		return readerCommandType;
	}

	@Override
	public ReaderCommand clone() throws CloneNotSupportedException {
		ReaderCommand rc = new ReaderCommand();
		rc.readerClass = this.readerClass;
		rc.readerId = this.readerId;
		rc.readerIp = this.readerIp;
		rc.readerPort = this.readerPort;
		rc.antennaProtocolSet = new HashSet<>();
			if(this.antennaProtocolSet != null){
			rc.antennaProtocolSet.addAll(this.antennaProtocolSet);
		}
		rc.readTagFieldList = new LinkedList<>();
		if(this.readTagFieldList != null){
			rc.readTagFieldList.addAll(this.readTagFieldList);
		}
		return rc;
	}

	public void setReaderCommandType(ReaderCommandType readerCommandType) {
		this.readerCommandType = readerCommandType;
	}

	public String getReaderClass() {
		return readerClass;
	}

	public void setReaderClass(String readerClass) {
		this.readerClass = readerClass;
	}

	public String getReaderId() {
		return readerId;
	}

	public void setReaderId(String readerId) {
		this.readerId = readerId;
	}

	public String getReaderIp() {
		return readerIp;
	}

	public void setReaderIp(String readerIp) {
		this.readerIp = readerIp;
	}

	public int getReaderPort() {
		return readerPort;
	}

	public void setReaderPort(int readerPort) {
		this.readerPort = readerPort;
	}

	public Set<AntennaProtocol> getAntennaProtocolSet() {
		return antennaProtocolSet;
	}

	public void setAntennaProtocolSet(Set<AntennaProtocol> antennaProtocolSet) {
		this.antennaProtocolSet = antennaProtocolSet;
	}

	public List<RawTagField> getReadTagFieldList() {
		return readTagFieldList;
	}

	public void setReadTagFieldList(List<RawTagField> readTagFieldList) {
		this.readTagFieldList = readTagFieldList;
	}
	
}
